package com.ifreeee.practice.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyInvocationHandler implements InvocationHandler {

    private IBase base;

    public ProxyInvocationHandler(IBase base) {
        this.base = base;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before");
        Object rtn = method.invoke(base, args);
        System.out.println("after");
        return rtn;
    }
}
